#ifndef OHOS_GL_UTIL_H_
#define OHOS_GL_UTIL_H_

#include <stdexcept>
#include <string>
#include <memory>
#include <GLES3/gl3.h>
#include <GLES2/gl2ext.h>
#include "matrix.h"

namespace webrtc {
class GlUtil {
 public:
  static const int NO_TEXTURE = -1;
  static const int WIDTH = -1;
  static const int HEIGHT = -1;

  GlUtil() = delete;

  static void CheckNoGLES2Error(const std::string &msg);

  static GLuint GenerateTexture(GLenum target);

  static std::unique_ptr<float[]> CreateFloatBuffer(const float *coords, size_t size);

  static void DeleteTexture(GLuint texture_id);

  static bool IsOesTexture(int gl_target);

  static void ConvertToGLMatrix(const Matrix &matrix, GLfloat *matrix4x4);
};
}
#endif
